home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-09-11 | 2.8 KB | 88 lines | [TEXT/CWIE] |
- // IACorpus.h
- // Copyright: © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
-
- #pragma once
- #ifndef IACorpus_h
- #define IACorpus_h
-
- #pragma import on
-
- #include "IAStorable.h"
-
- #pragma IA_BEGIN_EXPORTS
-
- class IADoc : public IAOrderedStorable {
- public:
- IA_INLINE ~IADoc() IA_INLINE_DEF() // no-op dtor def
- // returns the name of a document -- for test applications
- // note: returned array is allocated by IAMallocArray() and should be freed by IAFreeArray().
- virtual byte* GetName(uint32 *length) const;
- };
-
- class IADocText : public IAObject {
- public:
- IA_INLINE ~IADocText() IA_INLINE_DEF() // no-op dtor def
- // Extracts successive segments of the text of the document.
- // Returns number of bytes written into buffer.
- // Returns zero at end of document.
- virtual uint32 GetNextBuffer(byte* buffer, uint32 bufferLen) = 0;
- virtual IADocText* DeepCopy() const = 0;
- };
-
- class IADocIterator : public IAObject {
- public:
- IA_INLINE ~IADocIterator() IA_INLINE_DEF()// no-op dtor def
- // Advances the iterator to the next document in a set and returns it.
- // Enumeration is ordered, i.e., each document is LessThan() the next.
- // Returns NULL at the end of the set.
- // Note: returns a new copy of the document. Clients must delete.
- virtual IADoc* GetNextDoc() = 0;
- };
-
- // Thrown if iterator returns items that are not LessThan() next.
- IAExceptionCode CorpusIteratorOutOfOrder = 'VCIO';
-
- class IACorpus : public IAObject {
- public:
- IACorpus(uint32 type) : corpusType(type) {}
- IA_INLINE ~IACorpus() IA_INLINE_DEF() // no-op dtor def
-
- // Initializes persistent state.
- void Initialize(IAStorage* storage, IABlockID block);
- // Reads persistent state, including that of all analyses used.
- void Open(IAStorage* storage, IABlockID block);
- // Flushes any changes to persistent state, including that of all analyses used.
- void Update(IAStorage* storage, IABlockID block);
-
- // returns a prototype document, for bootstrapping sets of documents
- virtual IADoc* GetProtoDoc() = 0;
-
- // accesses the text of a document
- virtual IADocText* GetDocText(const IADoc* doc) = 0;
-
- // Determines set of documents to be indexed.
- virtual IADocIterator* GetDocIterator();
-
- const uint32 GetCorpusType() const {return corpusType;}
-
- protected:
- // Initialize() is implemented by subclasses with the following two methods:
- virtual IABlockSize InitialSize();
- virtual void Initializing(IAOutputBlock* output);
- // Open() is implemented by subclasses with the following:
- virtual void Opening(IAInputBlock* input);
- // Update() is implemented by subclasses with the following two methods:
- virtual IABlockSize UpdateSize();
- virtual void Updating(IAOutputBlock* output);
- private:
- const uint32 corpusType;
-
- };
-
- IAExceptionCode InvalidDocument = 'VCID';
-
- #pragma IA_END_EXPORTS
-
- #pragma import reset
- #endif
-